package hu.mapro.gwtui.gxt.client.columnmodel.field;

import hu.mapro.gwtui.gxt.client.columnmodel.ReadOnlyInterface;
import hu.mapro.model.Getter;
import hu.mapro.model.meta.Field;
import hu.mapro.model.meta.HasLabel;

public class ReadOnlyAdapter<T, F extends Field<T, ?>&HasLabel&Getter<T, ?>> implements ReadOnlyInterface<T, F> {

	@SuppressWarnings("unchecked")
	@Override
	public <V> V getValue(F field, T object) {
		return (V) field.get(object);
	}

	@Override
	public String getPath(F field) {
		return field.getName();
	}

	@Override
	public String getLabel(F field) {
		return field.getLabel();
	}

}